<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('文件资料列表')" />
    <!-- html主体 -->
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <!-- 头部搜索条件设置 -->
                <div class="select-list">
                    <ul>
                        <li>
                            <p>活动编号：</p>
                            <input type="text" name="activityId"/>
                        </li>
                        <li>
                            <p>资料类型：</p>
                            <select name="extType" th:with="type=${@dict.getType('degree')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <p>资料编号：</p>
                            <input type="text" name="fileId"/>
                        </li>

                        <li>
                            <p>活动名称：</p>
                            <input type="text" name="activityName"/>
                        </li>
                        <!-- 在数据库中搜索 -->
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <!-- 增删改查等操作按钮 -->
        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="vtsp:filelogs:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="vtsp:filelogs:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="vtsp:filelogs:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="vtsp:filelogs:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <!-- 显示主要信息 -->
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table">
                <thead>
                <tr>
                    <th data-checkbox="true"></th>
                    <th data-formatter="fm_rowIndex" data-align="center">序号</th>
                    <th data-field="activityId">活动编号</th>
                    <th data-field="extType"data-formatter="fl_state" data-align="center">资料类型</th>
                    <th data-field="fileId">资料编号</th>
                    <th data-field="activityName">活动名称</th>
                    <th data-field="fileNum">文件数量</th>
                    <th data-field="fileSize">文件大小</th>
                    <th data-field="createBy">创建人</th>
                    <th data-field="createTime">创建时间</th>
                    <th data-field="updateBy">更新者</th>
                    <th data-field="updateTime">更新时间</th>
                    <th data-formatter="fm_commands" data-width="180px" data-align="center">操作</th>
                </tr>
                </thead>
            </table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<!-- js模块 -->
<script th:inline="javascript">
    //获取操作
    var detailFlag =[[${@permission.hasPermi('vtsp:filelogs:detail')}]];
    var editFlag = [[${@permission.hasPermi('vtsp:filelogs:edit')}]];
    var uploadFlag = [[${@permission.hasPermi('vtsp:filelogs:upload')}]];
    var removeFlag = [[${@permission.hasPermi('vtsp:filelogs:remove')}]];
    var stateData = [[${@dict.getType('degree')}]];   //获取字典中的数据：状态
    //获取前缀
    var prefix = ctx + "vtsp/filelogs";

    $(function()
    {
        var options =
            {
                url: prefix + "/list",
                detailUrl:prefix + "/detail/{id}",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "文件资料",
                uniqueId: "fileLogid"
            };
        $.table.init(options);
    });
    //格式化字典数据
    function fl_state(value, row ,index)
    {
        return $.table.selectDictLabel(stateData, value);
    }

    //命令
    function fm_commands(value, row, index)
    {
        var actions = [];
        //传递参数，可以防止新建时的报错
        actions.push('<a class="btn btn-primary btn-xs ' + detailFlag + '" href="javascript:void(0)" ' +
            'onclick="$.operate.detail(\'' + row.fileLogid +'\')"><i class="fa fa-search"></i>查看</a> ');
        actions.push('<a class="btn btn-warning btn-xs ' + uploadFlag + '" href="javascript:void(0)" ' +
            'onclick="$.table.exportExcel()(\'' + row.fileLogid + '\' ,\'' + row.activityId + '\' ,\'' +row.extType + '\' ,\'' + row.fileId + '\' ,\''
            + row.activityName + '\' ,\'' + row.fileNum + '\' ,\'' + row.fileSize + '\' ,\'' +row.createBy + '\' ,\'' + row.createTime + '\' ,\''
            + row.updateBy + '\' ,\'' + row.updateTime +'\')"><i class="fa fa-download"></i>下载</a> ');
        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" ' +
            'onclick="$.operate.remove(\'' + row.fileLogid + '\' ,\'' + row.activityId + '\' ,\'' +row.extType + '\' ,\'' + row.fileId + '\' ,\''
            + row.activityName + '\' ,\'' + row.fileNum + '\' ,\'' + row.fileSize + '\' ,\'' +row.createBy + '\' ,\'' + row.createTime + '\' ,\''
            + row.updateBy + '\' ,\'' + row.updateTime +'\')"><i class="fa fa-remove"></i>删除</a>');
        return actions.join('');
    }
</script>
</body>
</html>
